cc.Class({
  extends: cc.Component,
  
  properties: {
    bgm: {
      type: cc.AudioClip,
      default: null
    },
    volume: 1,
  },
  
  onEnable() {
    if (!CC_EDITOR && this.bgm) {
      if (!AudioEngineWrapper.isMusicPlaying()) {
        AudioEngineWrapper.playMusic(this.bgm, this.volume);
      }
    }
  },
  onDisable() {
    AudioEngineWrapper.stopMusic();
  }
});
